package com.usian.service.Impl;

import com.usian.mapper.EtcMapper;
import com.usian.mapper.UserMapper;
import com.usian.pojo.Etc;
import com.usian.pojo.User;
import com.usian.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Autowired
    private EtcMapper etcMapper;
    @Override
    public User login(User user) {
        return userMapper.findLogin(user);
    }

    @Override
    public void add(User user) {
        userMapper.insert(user);
    }

    public List<Etc> findEtc2(Etc etc) {
        return etcMapper.findAll(etc);
    }

    @Override
    public void addEtc(Etc etc) {
        etcMapper.insert(etc);
    }

    @Override
    public void delStu(Integer id) {
        etcMapper.deleteByPrimaryKey(id);
    }

    @Override
    public Etc findById(Integer id) {
        return etcMapper.findById(id);
    }

    @Override
    public void update(Etc etc) {
        etcMapper.updateByPrimaryKeySelective(etc);
    }

    @Override
    public List<Etc> findEtc1(Etc etc) {
        return etcMapper.findAllAdmin(etc);
    }
}
